Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix button text alignment error. #586

Merged
merged 2 commits into from
Nov 16, 2023
Merged

Fix button text alignment error. #586

merged 2 commits into from
Nov 16, 2023

Conversation

mackron
Copy link
Contributor

@mackron mackron commented Nov 14, 2023

When calculating the width and height of the content rect of a button, only the border of one side is being taken into account. Instead the border width needs to be multiplied by two before subtracting from the bounds. This is being done for padding and rounding, but not border, which is resulting in text being misaligned. The screenshots below demonstrate the issue (I've exaggerated the borders to make it easier to see the effect).

Before:
image

After:
image

When calculating the width and height of the content rect of a button,
only the border of one side is being taken into account. Instead the
border width needs to be multiplied by two before subtracting from the
bounds. This is being done for padding and rounding, but not border,
which is resulting in text being misaligned, most notably when using
buttons with thick borders.
Copy link
Contributor

@riri riri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Be sure to rebase from master to get the latest version then bump the patch version in clib.json.

@mackron
Copy link
Contributor Author

mackron commented Nov 14, 2023

Cheers. clib.json updated. Was already up to date with master.

Copy link
Contributor

@riri riri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok for me, I let another maintainer reviewing for merging.

@RobLoach RobLoach merged commit 141d3cf into Immediate-Mode-UI:master Nov 16, 2023
1 check passed
@RobLoach
Copy link
Contributor

Good catch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants